Repository navigation
Keep a copy in Downloads from running what lies beside it - #35
Merged
Merged
Conversation
Given a bare name, std's Command searches the running executable's own folder before System32 and PATH, as Command::new documents, so a copy unpacked in Downloads would have run a powershell.exe or schtasks.exe lying beside it: the updater's after-exit shell, purge's, and the setup commands' removal of the old logon task. Both now come from the folder GetSystemDirectoryW names, with no fallback to the name. win::system_dir carries the rule, AGENTS.md the pitfall; a test per module checks the program each builds. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The imports that are not known DLLs -- msi.dll, winhttp.dll, bcrypt.dll, VCRUNTIME140.dll -- were looked for in the executable's own folder first, so a copy unpacked in Downloads loaded whatever lay beside it, before main. build.rs now links both executables with /DEPENDENTLOADFLAG:0x800 (LOAD_LIBRARY_SEARCH_SYSTEM32). Measured with a stand-in msi.dll beside a copy: the published 0.5.0 loaded it, this build does not. build.ps1 build reads the flag back from the PE load configuration, since losing it would change nothing anyone sees. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The dynamic runtime needs VCRUNTIME140.dll, which comes with the Visual C++ Redistributable, not with Windows, and the package never installed it: on a Windows without it the program would not start. A .cargo/config.toml now builds every MSVC target with +crt-static, the switch Rust documents; each executable grows by 97 KB, to 1.65 MB. A hybrid (vcruntime static, the UCRT from Windows) would weigh 22 KB and keep the UCRT serviced by Windows Update, at the price of two linker overrides; the design record has the figures. build.ps1 build checks that no executable imports a DLL of the Redistributable. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A copy unpacked in Downloads ran or loaded whatever lay beside it. Three commits close the three ways it did.
What changes
57e7670): Windows PowerShell (the updater's after-exit shell,purge) andschtasks.exe(the leftover-task check ofadd-to-startup,remove-from-startup,purge) start fromwin::system_dir(), which isGetSystemDirectoryW, with no fallback to the name. Given a bare name, std searches the executable's own folder first, asCommand::newdocuments.16559ab):build.rslinks both executables with/DEPENDENTLOADFLAG:0x800.msi.dll,winhttp.dll,bcrypt.dllandVCRUNTIME140.dllare not known DLLs, so they were looked for beside the executable first.build.ps1 buildreads the flag back from the PE.ffdadba):+crt-staticin.cargo/config.toml.VCRUNTIME140.dllcomes with the Visual C++ Redistributable, which the package never installed.build.ps1 buildchecks that no executable imports a DLL of the Redistributable.Measured (2026-11-24, this machine)
schtasks.exebeside a copy,purgestopped at its questionmsi.dllbeside a copy,--versionmaingamemode-executor.exesizebcryptprimitives.dllwas loaded by neither, since a system DLL had already loaded Windows' own.909f77b7, the same code before a test-only line was added). The watcher started, andmsi,winhttp,bcryptandbcryptprimitiveswere loaded from System32. Novcruntime140.dllwas loaded, and no module came from the install folder.build.ps1 buildpasses, including the two new steps.Not verified
purgeneed the next release. The hidden shell's spawn is covered by the twopurgetests that run it for real, andschtasks.exe's by its unit test.Not in this PR
actions.rs; the recipes'schtasks.exeandpowercfg.exe) still go through std's search. That fix is handed to another session.🤖 Generated with Claude Code